# 登录 --> 得到cookie
# 带着cookie去请求书架的url --> 获取书架的数据
# 通过session进行请求且cookie不会丢失
import requests

# 1.获取登录的url并获得cookie
url = "https://passport.17k.com/ck/user/login"
session = requests.session()
data={
    "loginName": "19960987532",
    "password": "wj3138641158"
}

resp = session.post(url,data=data)
# print(resp.text)
# 查看cookies --> resp.cookies
# print(resp.cookies)

# 2.拿到书架的url刚才拿到session中有cookie
book_url = "https://user.17k.com/ck/author2/shelf?page=1&appKey=2406394919"
book_resp = session.get(book_url)
js = book_resp.json()
print(js.get("data"))